/*
 * @Author: yuanweijiang
 * @Date: 2024-01-05 11:12:16
 * @LastEditors: yuanweijiang
 */
import request from '/@/utils/request';

export const addPost = (data: any) => {
	return request({
		url: '/geoserver/geoWork/addGeoWorkSpace',
		method: 'post',
		data,
	});
};

export const getList = (data: any) => {
	return request({
		url: '/geoserver/geoWork/getGeoWorkSpaceByPage',
		method: 'post',
		data,
	});
};
export const delPost = (data: any) => {
	return request({
		url: '/geoserver/geoWork/delGeoWorkSpace',
		method: 'post',
		data,
	});
};

export const editPost = (data: any) => {
	return request({
		url: '/geoserver/geoWork/updateGeoWorkSpaceName',
		method: 'post',
		data,
	});
};

export const rolesGet = (data: any) => {
	return request({
		url: '/geoserver/roleProject/getRoleProjectRelationByName',
		method: 'get',
		params: data,
	});
};
//获取文件管理列表
export const getFileList = (data: any) => {
	return request({
		url: '/geoserver/fileDataSource/getFileDataSource',
		method: 'post',
		data,
	});
};
//删除文件列表

export const delFileList = (data: any) => {
	return request({
		url: '/geoserver/fileDataSource/delFileDataSource',
		method: 'post',
		data,
	});
};

export const downFile = (fileId: string) => {
	return request({
		url: `/geoserver/file/downFile/${fileId}`,
		method: 'get',
		responseType: 'blob',
	});
};
//发布成功

export const saveSubmit = (data: any) => {
	return request({
		url: '/geoserver/geoLayer/publishGeoLayer',
		method: 'post',
		data,
	});
};

//根据项目名称查询图层列表
export const geoLayerList = (data: any) => {
	return request({
		url: '/geoserver/geoLayer/getGeoLayerByName',
		method: 'post',
		params: data,
	});
};
export const fileDataSourceLsit = (data: any) => {
	return request({
		url: '/geoserver/fileDataSource/getFileDataSourceByProjectName',
		method: 'get',
		params: data,
	});
};
export const fileDataSourceObj = (data: any) => {
	return request({
		url: '/geoserver/fileDataSource/getFileDataSourceByName',
		method: 'get',
		params: data,
	});
};
//根据文件名获取样式
export const getStyle = (data: any) => {
	return request({
		url: '/geoserver/geoStyle/findGeoStyleList',
		method: 'post',
		data,
	});
};

export const getCoordinatelist = (data: any) => {
	return request({
		url: '/geoserver/coordinate/getIPageGeoCoordinateVo',
		method: 'post',
		data,
	});
};

export const getGeoLayer = (data: any) => {
	return request({
		url: '/geoserver/geoLayer/getSourceCRS',
		method: 'post',
		data,
	});
};

// 保存文件资源
export const addFileData = (data: any) => {
	return request({
		url: '/geoserver/fileDataSource/addFileDataSource',
		method: 'post',
		data,
	});
};

// 修改文件资源名和描述
export const editFileData = (data: any) => {
	return request({
		url: '/geoserver/fileDataSource/updateFileSourceInfo',
		method: 'post',
		data,
	});
};

// 发布基础底图
export const updateDataSourceStatus = (data: any) => {
	return request({
		url: '/geoserver/fileDataSource/updateDataSourceStatusDto',
		method: 'post',
		data,
	});
};

// 文件资源标签
export const updateDataLabel = (data: any) => {
	return request({
		url: '/geoserver/fileDataSource/updateFileDataSourceLabel',
		method: 'post',
		data,
	});
};

// PostGis链接测试
export const testPostGIS = (data: any) => {
	return request({
		url: '/bussiness/datasource/testConnection',
		method: 'post',
		data,
	});
};
export const treeDataCatalog = (data) => {
	return request({
		url: '/geoserver/aogeResource/getChildrenCatalog',
		method: 'post',
		data,
	});
};
export const postAgCloud = (data) => {
	return request({
		url: '/geoserver/aogeResource/postAgCloud',
		method: 'post',
		data,
	});
};
export const treeDataCatalogTree = () => {
	return request({
		url: '/geoserver/aogeResource/treeDataCatalog',
		method: 'get',
	});
};
export const publishAgLayer = (data) => {
	return request({
		url: '/geoserver/aogeResource/publishAgLayer',
		method: 'post',
		data,
	});
};
